#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <set>
#include <vector>


using namespace std;

int findd(int dist, vector<int> &distancias) {
  int b = -1, e = distancias.size();
  while (b+1 < e) {
    int med = (b+e)/2;
    if (distancias[med] <= dist) b = med;
    else e = med;
  }
  return e;
}

int main() {
  int i,j ,k;
  int N;
  int casos = 0;
  while (cin >> N) {
    casos++;
    if(!N) break;
  vector<int> disa, disb, disboth;
  vector<pair<int,int> > vec;
  for (i = 0; i < N; ++i) {
    int a, b;cin >> a >> b;
    vec.push_back(make_pair(a,b));
  }
  int ax, ay, bx, by;
  cin >> ax >> ay >> bx >> by;

  for (i = 0; i < N; ++i) {
    int dxa, dya, dxb, dyb;
    dxa = vec[i].first-ax;
    dya = vec[i].second-ay;
    disa.push_back(dxa*dxa+dya*dya);

    dxb = vec[i].first-bx;
    dyb = vec[i].second-by;
    disb.push_back(dxb*dxb+dyb*dyb);
    
    disboth.push_back(max(disa[i], disb[i]));
  }
  sort(disa.begin(), disa.end());
  sort(disb.begin(), disb.end());
  sort(disboth.begin(), disboth.end());
  int q; cin >> q;
  vector<pair<pair<int,int>, int> > query;
  for (i = 0; i < q; ++i) {
    int r1, r2;
    cin >> r1 >> r2;
    r1 = r1 * r1;
    r2 = r2 * r2;
    query.push_back(make_pair(make_pair(r1,r2), i));
    //cout << max(0, N-find(disa,r1)-find(disb,r2)
  }
  vector<pair<int,int> > points;
  for (i = 0; i < N; ++i) {
    points.push_back(make_pair(disa[i], disb[i]));
  }
  sort(points.begin(), points.end());
  int ind = 0;
  set<int> values;
  int res[20100];
  memset(res, 0, sizeof(res));
  /*
  for (i = 0; i < query.size(); ++i) {
    if (ind < points.size() && points[ind].first <= query[i].first.first)
      values.insert(points[ind].second), ind++;
    res[query[i].second] +=
        distance(values.begin(), values.upper_bound(query[i].first.second));
  }*/
  //for (i = 0; i < disa.size(); ++i ) cout << "  " << disa[i] ; cout  <<
   // 25*25  << endl;
  cout<< "Case " << casos << ":" << endl;
  for (i = 0; i < query.size(); ++i) {
    int a = findd(query[i].first.first, disa);
    int b = findd(query[i].first.second, disb); 
   // cout << a << "  " << b << "HOLA << end" << endl;
    cout << max(0, N-a-b) << endl;
  }
  }
  return 0;
}
